<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%-- <%@ taglib prefix="battcn" uri="http://www.battcn.com/tags"%> --%>
<script type="text/javascript">
  $(document).ready(function(){$(".i-checks").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",})});
  $(function(){
	  xf.admin.menu${OP.menuId}.save = function(obj) {
  		if($("#menu${OP.menuId}Form").valid()){
  			$.ajax({
				type: "POST", 
				url: rootPath + "/op_save_${OP.menuId}.do",
				data: $('#menu${OP.menuId}Form').serializeArray(),
				dataType: "json",
				success: function(data){
					if(data.success) {
						xf.closeWindow();
						$('#admin_menu${OP.menuId}_datagrid').bootstrapTable('refresh');
					}
					xf.toastrsAlert({
		       		     code: data.success ? 'success' :'error',
		       		     msg: data.msg
		       		});
				}
			});
  		}
	}
	  
    xf.admin.menu${OP.menuId}.update = function(obj) {
  		if($("#menu${OP.menuId}Form").valid()){
  			$.ajax({
				type: "POST", 
				url: rootPath + "/op_update_${OP.menuId}.do",
				data: $('#menu${OP.menuId}Form').serializeArray(),
				dataType: "json",
				success: function(data){
					if(data.success) {
						xf.closeWindow();
						$('#admin_menu${OP.menuId}_datagrid').bootstrapTable('refresh');
					}
					xf.toastrsAlert({
		       		     code: data.success ? 'success' :'error',
		       		     msg: data.msg
		       		});
				}
			});
  		}
	}
    
    $.ajax({
		type: "POST", 
		url: rootPath + "/sysMenu/selectParentMenu.do",
		dataType: 'json',
		success: function(data){
			$('#parentId').selectPage({
       	     showField : 'name',
       	     keyField : 'id',
       	     data : data
       	    });
			
		}
	});
  });
</script>
<div class="ibox float-e-margins animated fadeInRight">
	<div class="ibox-content">
		<form class="form-horizontal m-t required-validate"
			id="menu${OP.menuId}Form" action="op_save_${OP.menuId}.do"
			method="post">
			<input type="hidden" name="menuId" value="${dto.menuId}" />
			<div class="form-group">
				<label class="col-sm-3 control-label">菜单名称：</label>
				<div class="col-sm-8">
					<input name="menuName" class="form-control" type="text"
						value="${dto.menuName}"
						validate="{required:true,messages:{required:'请填菜单名称'}}">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">菜单地址：</label>
				<div class="col-sm-8">
					<input name="menuUrl" class="form-control" type="text"
						value="${dto.menuUrl}">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">菜单图标：</label>
				<div class="col-sm-8">
					<input name="menuImg" class="form-control" type="text"
						value="${dto.menuImg}"
						validate="{required:true,messages:{required:'请选择菜单图标'}}">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">菜单参数：</label>
				<div class="col-sm-8">
					<input name="menuParam" class="form-control" type="text"
						value="${dto.menuParam}">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">父级菜单：</label>
				<div class="col-sm-8">
				    <input name="parentId" class="form-control" type="text"
						value="${dto.parentId}"  id="parentId">
<!-- 					<input type="text" class="form-control" name="parentId" id="parentId"> -->
				</div>
			</div>
			<div class="form-group">
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">状态：</label>
				<div class="col-sm-8">
					<div class="radio i-checks radio-inline">
						<label> <input type="radio" value="00"
							<c:if test="${dto.status == '00'}"> checked</c:if> name="status">
							<i></i> 启动
						</label>
					</div>
					<div class="radio i-checks    radio-inline">
						<label> <input type="radio"
							<c:if test="${dto.status == '10'}"> checked</c:if> value="10"
							name="status"> <i></i>禁用
						</label>
					</div>
				</div>
			</div>
		</form>
	</div>
</div>
